package org.minos.edit.controller
{
	import org.minos.edit.EditFacate;
	import org.minos.edit.Main;
	import org.minos.edit.model.ClearProxy;
	import org.minos.edit.view.components.Menu;
	import org.minos.edit.view.EditMediator;
	import org.minos.edit.view.InfoPaneMediator;
	import org.minos.edit.view.InitInfoMediator;
	import org.minos.edit.view.MenuMediator;
	import org.minos.edit.view.TableMediator;
	import org.minos.edit.view.ToolBarMediator;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	
	/**
	 * ...
	 * @author M.ichow
	 */
	public class ViewPreCommand extends SimpleCommand
	{
		
		public function ViewPreCommand()
		{
		}
		
		override public function execute( notification : INotification ) : void
		{
			super.execute( notification );
			
			var app : Main = notification.getBody() as Main;
			
			facade.registerMediator( new EditMediator( app ) );
			facade.registerMediator( new MenuMediator( app.menuContainer ) );
			facade.registerMediator( new InfoPaneMediator( app.infoContainer ) );
			facade.registerMediator( new ToolBarMediator( app.toolContainer ) );
			facade.registerMediator( new TableMediator( app.sceneContainer ) );
			facade.registerMediator( new InitInfoMediator( app.initInfoContainer ) );
			
			//
			var clear : ClearProxy = facade.retrieveProxy( ClearProxy.NAME ) as ClearProxy;
			clear.addComponent( app.infoContainer );
			clear.addComponent( app.sceneContainer );
			clear.addComponent( app.initInfoContainer );
			//
			//init components
			sendNotification( EditFacate.SCENE_SELECTION_CHANGED );
			sendNotification( EditFacate.FILE_CHANGED );
		}
	
	}

}